/***************************************************************************
 *   Copyright (C) 2009 by maarten,,,   *
 *   maarten@maarten-laptop   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "objects/object.h"
#include "objects/plane.h"
#include "objects/vertex.h"
#include "objects/objecttexture.h"
#include "objects/normal.h"

#include <QString>

namespace object {

Object::Object()
{
}


Object::~Object()
{
    for(int i = 0; i < m_planeList.size(); ++i)
        delete m_planeList.at(i);

    for(int i = 0; i < m_vertexList.size(); ++i)
        delete m_vertexList.at(i);
   
    for(int i = 0; i < m_textureList.size(); ++i)
        delete m_textureList.at(i);
   
    for(int i = 0; i < m_normalList.size(); ++i)
        delete m_normalList.at(i);   
}

void Object::addPlane(Plane *plane)
{
    m_planeList.push_back(plane);
}

void Object::addVertex(Vertex *vertex)
{
    m_vertexList.push_back(vertex);
}

void Object::addTexture(ObjectTexture *texture)
{
    m_textureList.push_back(texture);
}

void Object::addNormal(Normal *normal)
{
    m_normalList.push_back(normal);
}

Vertex* Object::getVertex(int id)
{
    return m_vertexList[id];
}

ObjectTexture* Object::getTexture(int id)
{
    return m_textureList[id];
}

Normal* Object::getNormal(int id)
{
    return m_normalList[id];
}

Plane* Object::getPlane(int id)
{
    return m_planeList[id];
}

void Object::print()
{
    qDebug("Object:");
    qDebug("Nr of planes:" + QString::number(m_planeList.size()).toLatin1());
    for(int i = 0; i < m_planeList.size(); ++i)
        m_planeList[i]->print();
}

}
